package com.ruoyi.commodity.domain;

import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.annotation.Excels;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.ruoyi.system.api.domain.SysDept;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.math.BigDecimal;

/**
 * @author: Steven
 * @date: 2023/7/7 0007 11:18
 **/
@EqualsAndHashCode(callSuper = true)
@Data
public class Commodity extends BaseEntity {
    @Excel(name = "商品ID")
    private Long commodityId;

    @Excel(name = "名称")
    private String name;

    @Excel(name = "商品售价")
    private BigDecimal price;

    @Excel(name = "销量")
    private Integer salesNumber;

    @Excel(name = "库存")
    private Integer stock;

    @Excel(name = "排序")
    private Integer orderNum;

    @Excel(name = "商品状态")
    private String status;

    @Excel(name = "收藏数量")
    private Integer collectNumber;

    @Excel(name = "市场价")
    private Integer marketPrice;

    @Excel(name = "成本价")
    private Integer costPrice;

    @Excel(name = "虚拟销量")
    private Integer virtualSales;

    @Excel(name = "商品关键字")
    private String keywords;

    @Excel(name = "商品描述")
    private String description;

    @Excel(name = "商品单位")
    private String unit;

    @Excel(name = "积分")
    private Integer score;

    /* 商品分类对应的ID */
    private String categoryId;

    /** 部门对象 */
    @Excels({
            @Excel(name = "商品分类", targetAttr = "categoryName", type = Excel.Type.EXPORT)
    })
    private CommodityCategory commodityCategory;

    @NotBlank(message = "商品名称不能为空")
    @Size(min = 0, max = 30, message = "商品名称长度不能超过30个字符")
    public String getCommodityName()
    {
        return name;
    }
}
